var t,
  a,
  i = require("../../@babel/runtime/helpers/defineProperty"),
  n = require("../../res/www.a9a.cn.js"),
  e = getApp(),
  o = 2,
  s = !0;
Page({
  data: {
    nTitle: "互选",
    triggered: !0,
    loading_flag: !1,
    loading_ico_flag: !1,
    loading_str: "拼命加载中",
  },
  onLoad: function (t) {
    var a = this;
    e.get_config("_ZEAI").then(function (t) {
      a.setData({ color: e._ZEAI.color, rgbcolor: n.c16_rgb(e._ZEAI.color) }),
        a.init();
    }),
      e.get_navigationBarTopHeight(a);
  },
  init: function () {
    var o = this;
    wx.showLoading({ title: "拼命加载中...", mask: !0 }), (s = !1);
    var r = {
      submitok: "huxuan",
      openid: (t = wx.getStorageSync("COOK_U")).openid,
    };
    n.empty(a) ||
      (r = JSON.parse(
        (JSON.stringify(r) + JSON.stringify(a)).replace(/}{/, ",")
      )),
      e.ajax({
        url: "huxuan.php",
        data: r,
        success: function (t) {
          var a;
          1 == t.flag
            ? 0 == t.LIST.length
              ? o.setData({
                  LIST: [],
                  SO: t.SO,
                  huxuan_nodata: !0,
                  SHARE: t.SHARE,
                })
              : o.setData(
                  (i((a = {}), "LIST[0]", t.LIST),
                  i(a, "SO", t.SO),
                  i(a, "SHARE", t.SHARE),
                  a)
                )
            : wx.showToast({ title: t.msg, icon: "none", mask: !0 });
          (s = !0), wx.hideLoading();
        },
      });
  },
  blankFn: function () {},
  SOFn: function () {
    this.setData({ div_right_mask_class: "alpha0_100", div_right_flag: !0 });
  },
  SO_close_Fn: function () {
    var t = this;
    this.setData({ div_right_mask_class: "alpha100_0" }),
      setTimeout(function () {
        t.setData({ div_right_flag: !1 });
      }, 500);
  },
  SO_form_uid_submitFn: function (t) {
    var i = t.detail.value.keyword;
    (a = { keyword: i }), this.SO_close_Fn(), this.init();
  },
  SO_input_uid_submitFn: function (t) {
    var i = t.detail.value;
    (a = { keyword: i }), this.SO_close_Fn(), this.init();
  },
  SO_uid_bindblurFn: function (t) {
    var a = t.detail.value;
    this.setData({ keyword: a });
  },
  SO_ext_liFn: function (t) {
    var a,
      e = t.currentTarget.dataset.idx,
      o = t.currentTarget.dataset.v,
      s = t.currentTarget.dataset.fkind,
      r = this.data.SO[e].v;
    (a = n.empty(r)
      ? o
      : "checkbox" == s
      ? n.indexOf(r, o)
        ? (a = n.json_remove(r, o)).join(",")
        : r + "," + o
      : o),
      0 == o && (a = 0),
      this.setData(i({}, "SO[" + e + "].v", a));
  },
  SO_ext_submitFn: function (t) {
    ((a = t.detail.value).keyword = this.data.keyword),
      this.SO_close_Fn(),
      this.init();
  },
  SO_ext_resetFn: function (t) {
    var a = this.data.SO;
    for (var n in a) this.setData(i({}, "SO[" + n + "].v", 0));
    this.setData({ keyword: "" });
  },
  nodatabackFn: function (t) {
    (a = ""),
      this.setData({
        loading_flag: !1,
        loading_str: "拼命加载中",
        LIST: [],
        huxuan_nodata: !1,
      }),
      (o = 2),
      this.init();
  },
  onShow: function () {},
  onPullDownRefresh: function () {
    var t = this;
    wx.vibrateShort({ type: "heavy" }),
      setTimeout(function () {
        (a = ""),
          t.setData({
            triggered: !1,
            loading_flag: !1,
            loading_str: "拼命加载中",
            LIST: [],
            huxuan_nodata: !1,
          }),
          t.setloading("end", "拼命加载中"),
          (o = 2),
          t.init();
      }, 500);
  },
  setloading: function (t, a) {
    "start" == t
      ? this.setData({ loading_flag: !0, loading_ico_flag: !0, loading_str: a })
      : this.setData({
          loading_flag: !1,
          loading_ico_flag: !1,
          loading_str: a,
        });
  },
  onReachBottom: function () {
    var r = this.data.LIST,
      l = this;
    if (s) {
      (s = !1), l.setloading("start", "拼命加载中");
      var u = { submitok: "huxuan", p: o, openid: t.openid };
      n.empty(a) ||
        (u = JSON.parse(
          (JSON.stringify(u) + JSON.stringify(index_par)).replace(/}{/, ",")
        )),
        e.ajax({
          url: "huxuan.php",
          data: u,
          success: function (t) {
            if (1 == t.flag) {
              var a = r.length;
              if (t.LIST.length < 1)
                return l.setloading("end", "已全部加载完毕"), void (s = !1);
              l.setData(i({}, "LIST[" + a + "]", t.LIST)), (o += 1), (s = !0);
            } else wx.showToast({ title: t.msg, icon: "none", mask: !0 });
            l.setloading("end", "上拉加载更多");
          },
        });
    }
  },
  binnd_scroll_index: function (t) {},
  onShareAppMessage: function (t) {
    return {
      imageUrl: this.data.SHARE.imgurl,
      title: this.data.SHARE.title,
      path: "/pages/huxuan/huxuan",
    };
  },
  onShareTimeline: function () {
    return {
      imageUrl: this.data.SHARE.imgurl,
      title: this.data.SHARE.title,
      query: "",
      path: "/pages/huxuan/huxuan",
    };
  },
});
